<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NumCpp: Centroid.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NumCppLogoDoxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">NumCpp
   &#160;<span id="projectnumber">2.1.0</span>
   </div>
   <div id="projectbrief">A C++ implementation of the Python Numpy library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_centroid_8hpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Centroid.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_centroid_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_static_asserts_8hpp.html">NumCpp/Core/Internal/StaticAsserts.hpp</a>&quot;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_types_8hpp.html">NumCpp/Core/Types.hpp</a>&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="center_of_mass_8hpp.html">NumCpp/Functions/centerOfMass.hpp</a>&quot;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_cluster_8hpp.html">NumCpp/ImageProcessing/Cluster.hpp</a>&quot;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_nd_array_8hpp.html">NumCpp/NdArray.hpp</a>&quot;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="num2str_8hpp.html">NumCpp/Utils/num2str.hpp</a>&quot;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacenc.html">nc</a></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;{</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keyword">namespace </span>imageProcessing</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    {</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        <span class="comment">//================================================================================</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="comment">// Class Description:</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment"></span>        <span class="keyword">template</span>&lt;<span class="keyword">typename</span> dtype&gt;</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html">   49</a></span>&#160;        <span class="keyword">class </span><a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid</a></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        {</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;            STATIC_ASSERT_ARITHMETIC(dtype);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment"></span>            <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a3b97e4ddc31b85eb8c3f84b398429a35">Centroid</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a59d0af7acae8d24d29ccb372440aed22">   67</a></span>&#160;<span class="comment"></span>            <span class="keyword">explicit</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a59d0af7acae8d24d29ccb372440aed22">Centroid</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_cluster.html">Cluster&lt;dtype&gt;</a>&amp; inCluster) :</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;                intensity_(inCluster.<a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">intensity</a>()),</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;                eod_(inCluster.<a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">eod</a>())</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;            {</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;                centerOfMass(inCluster);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            }</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8">   81</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">double</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8">row</a>() const noexcept </div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            {</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                <span class="keywordflow">return</span> row_;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            }</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160; </div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a4ef0e9b2faa4999af5c3597a60140d6c">   93</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">double</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a4ef0e9b2faa4999af5c3597a60140d6c">col</a>() const noexcept </div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            {</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                <span class="keywordflow">return</span> col_;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            }</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">  105</a></span>&#160;<span class="comment"></span>            dtype <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">intensity</a>() const noexcept </div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            {</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                <span class="keywordflow">return</span> intensity_;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;            }</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">  117</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">double</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">eod</a>() const noexcept </div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            {</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                <span class="keywordflow">return</span> eod_;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;            }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">  129</a></span>&#160;<span class="comment"></span>            std::string <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">str</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="keyword">            </span>{</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                std::string out;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                out += <span class="stringliteral">&quot;row = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(row_) + <span class="stringliteral">&quot; col = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(col_);</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;                out += <span class="stringliteral">&quot; intensity = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(intensity_) + <span class="stringliteral">&quot; eod = &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(eod_) + <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;                <span class="keywordflow">return</span> out;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            }</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160; </div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a139efcdd994d1bacdf62d65b3c427d8d">  142</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">void</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a139efcdd994d1bacdf62d65b3c427d8d">print</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;<span class="keyword">            </span>{</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;                std::cout &lt;&lt; *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            }</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a503a2542b388f65fb80710dd33610abc">  157</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a503a2542b388f65fb80710dd33610abc">operator==</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid&lt;dtype&gt;</a>&amp; rhs) <span class="keyword">const</span> noexcept </div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;            {</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;                <span class="keywordflow">return</span> row_ == rhs.row_ &amp;&amp; col_ == rhs.col_ &amp;&amp; intensity_ == rhs.intensity_ &amp;&amp; eod_ == rhs.eod_;</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;            }</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160; </div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a89eb742174a9dd27b730ce4502e119cd">  172</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a89eb742174a9dd27b730ce4502e119cd">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid&lt;dtype&gt;</a>&amp; rhs) <span class="keyword">const</span> noexcept </div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;            {</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == rhs);</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;            }</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a093719e81ed5bd5af0cb80dcfd03289f">  190</a></span>&#160;<span class="comment"></span>            <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a093719e81ed5bd5af0cb80dcfd03289f">operator&lt;</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid&lt;dtype&gt;</a>&amp; rhs) <span class="keyword">const</span> noexcept </div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            {</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;                <span class="keywordflow">return</span> intensity_ &lt; rhs.intensity_ ? false : <span class="keyword">true</span>;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;            }</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160; </div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00204"></a><span class="lineno"><a class="line" href="classnc_1_1image_processing_1_1_centroid.html#a787da1f79223e97a2788a2ad47e1c394">  204</a></span>&#160;<span class="comment"></span>            <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classnc_1_1image_processing_1_1_centroid.html#a787da1f79223e97a2788a2ad47e1c394">operator&lt;&lt;</a>(std::ostream&amp; inStream, <span class="keyword">const</span> <a class="code" href="classnc_1_1image_processing_1_1_centroid.html">Centroid&lt;dtype&gt;</a>&amp; inCentriod)</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;            {</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;                inStream &lt;&lt; inCentriod.<a class="code" href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">str</a>();</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;                <span class="keywordflow">return</span> inStream;</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            }</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;            <span class="comment">//==================================Attributes================================///</span></div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;            <span class="keywordtype">double</span>          row_{ 0.0 };</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;            <span class="keywordtype">double</span>          col_{ 0.0 };</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;            dtype           intensity_{ 0 };</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;            <span class="keywordtype">double</span>          eod_{ 0.0 };</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160; </div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;            <span class="comment">//=============================================================================</span></div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;            <span class="comment">// Description:</span></div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;<span class="comment"></span>            <span class="keywordtype">void</span> centerOfMass(<span class="keyword">const</span> Cluster&lt;dtype&gt;&amp; inCluster) </div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;            {</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                <span class="keyword">const</span> Shape clusterShape(inCluster.height(), inCluster.width());</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;                NdArray&lt;dtype&gt; clusterArray(clusterShape);</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;                clusterArray.zeros();</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160; </div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacenc.html#af0f49663fb63332596e2e6327009d581">uint32</a> rowMin = inCluster.rowMin();</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacenc.html#af0f49663fb63332596e2e6327009d581">uint32</a> colMin = inCluster.colMin();</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160; </div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;                <span class="keywordflow">for</span> (<span class="keyword">auto</span>&amp; pixel : inCluster)</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;                {</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;                    clusterArray(pixel.row - rowMin, pixel.col - colMin) = pixel.intensity;</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                }</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160; </div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                <span class="keyword">const</span> <span class="keyword">auto</span> rowCol = <a class="code" href="namespacenc.html#a830888da11b33ea36bf4fc580d8c4757">nc::centerOfMass</a>(clusterArray);</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;                row_ = rowCol.front() + rowMin;</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                col_ = rowCol.back() + colMin;</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;            }</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;        };</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    }  <span class="comment">// namespace imageProcessing</span></div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;}  <span class="comment">// namespace nc</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="a_static_asserts_8hpp_html"><div class="ttname"><a href="_static_asserts_8hpp.html">StaticAsserts.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a89eb742174a9dd27b730ce4502e119cd"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a89eb742174a9dd27b730ce4502e119cd">nc::imageProcessing::Centroid::operator!=</a></div><div class="ttdeci">bool operator!=(const Centroid&lt; dtype &gt; &amp;rhs) const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:172</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_aa203a8f8138fe9679f307f38ad65a5aa"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#aa203a8f8138fe9679f307f38ad65a5aa">nc::imageProcessing::Centroid::intensity</a></div><div class="ttdeci">dtype intensity() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:105</div></div>
<div class="ttc" id="anamespacenc_1_1utils_html_a16a6ad93c420ed7a003d9921bee1a7c6"><div class="ttname"><a href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">nc::utils::num2str</a></div><div class="ttdeci">std::string num2str(dtype inNumber)</div><div class="ttdef"><b>Definition:</b> num2str.hpp:47</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_aa39ae81638b8f7ed7b81d4476e2a6316"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#aa39ae81638b8f7ed7b81d4476e2a6316">nc::imageProcessing::Centroid::str</a></div><div class="ttdeci">std::string str() const</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:129</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a59d0af7acae8d24d29ccb372440aed22"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a59d0af7acae8d24d29ccb372440aed22">nc::imageProcessing::Centroid::Centroid</a></div><div class="ttdeci">Centroid(const Cluster&lt; dtype &gt; &amp;inCluster)</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:67</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a503a2542b388f65fb80710dd33610abc"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a503a2542b388f65fb80710dd33610abc">nc::imageProcessing::Centroid::operator==</a></div><div class="ttdeci">bool operator==(const Centroid&lt; dtype &gt; &amp;rhs) const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:157</div></div>
<div class="ttc" id="anamespacenc_html_af0f49663fb63332596e2e6327009d581"><div class="ttname"><a href="namespacenc.html#af0f49663fb63332596e2e6327009d581">nc::uint32</a></div><div class="ttdeci">std::uint32_t uint32</div><div class="ttdef"><b>Definition:</b> Types.hpp:41</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a098ee235ea6fcf22df2a7a0d80d53e44"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a098ee235ea6fcf22df2a7a0d80d53e44">nc::imageProcessing::Centroid::eod</a></div><div class="ttdeci">double eod() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:117</div></div>
<div class="ttc" id="a_nd_array_8hpp_html"><div class="ttname"><a href="_nd_array_8hpp.html">NdArray.hpp</a></div></div>
<div class="ttc" id="anum2str_8hpp_html"><div class="ttname"><a href="num2str_8hpp.html">num2str.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a093719e81ed5bd5af0cb80dcfd03289f"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a093719e81ed5bd5af0cb80dcfd03289f">nc::imageProcessing::Centroid::operator&lt;</a></div><div class="ttdeci">bool operator&lt;(const Centroid&lt; dtype &gt; &amp;rhs) const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:190</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a4ef0e9b2faa4999af5c3597a60140d6c"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a4ef0e9b2faa4999af5c3597a60140d6c">nc::imageProcessing::Centroid::col</a></div><div class="ttdeci">double col() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:93</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_aa3546b7b2430b51650f40fb344ab55a8"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8">nc::imageProcessing::Centroid::row</a></div><div class="ttdeci">double row() const noexcept</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:81</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a3b97e4ddc31b85eb8c3f84b398429a35"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a3b97e4ddc31b85eb8c3f84b398429a35">nc::imageProcessing::Centroid::Centroid</a></div><div class="ttdeci">Centroid()=default</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a787da1f79223e97a2788a2ad47e1c394"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a787da1f79223e97a2788a2ad47e1c394">nc::imageProcessing::Centroid::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;inStream, const Centroid&lt; dtype &gt; &amp;inCentriod)</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:204</div></div>
<div class="ttc" id="anamespacenc_html"><div class="ttname"><a href="namespacenc.html">nc</a></div><div class="ttdef"><b>Definition:</b> Coordinate.hpp:45</div></div>
<div class="ttc" id="a_cluster_8hpp_html"><div class="ttname"><a href="_cluster_8hpp.html">Cluster.hpp</a></div></div>
<div class="ttc" id="acenter_of_mass_8hpp_html"><div class="ttname"><a href="center_of_mass_8hpp.html">centerOfMass.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html_a139efcdd994d1bacdf62d65b3c427d8d"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html#a139efcdd994d1bacdf62d65b3c427d8d">nc::imageProcessing::Centroid::print</a></div><div class="ttdeci">void print() const</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:142</div></div>
<div class="ttc" id="a_types_8hpp_html"><div class="ttname"><a href="_types_8hpp.html">Types.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_centroid_html"><div class="ttname"><a href="classnc_1_1image_processing_1_1_centroid.html">nc::imageProcessing::Centroid</a></div><div class="ttdoc">holds the information for a centroid</div><div class="ttdef"><b>Definition:</b> Centroid.hpp:49</div></div>
<div class="ttc" id="aclassnc_1_1image_processing_1_1_cluster_html"><div class="ttname"><a href="classnc_1_1image_processing_1_1_cluster.html">nc::imageProcessing::Cluster</a></div><div class="ttdoc">Holds the information for a cluster of pixels.</div><div class="ttdef"><b>Definition:</b> Cluster.hpp:54</div></div>
<div class="ttc" id="anamespacenc_html_a830888da11b33ea36bf4fc580d8c4757"><div class="ttname"><a href="namespacenc.html#a830888da11b33ea36bf4fc580d8c4757">nc::centerOfMass</a></div><div class="ttdeci">NdArray&lt; double &gt; centerOfMass(const NdArray&lt; dtype &gt; &amp;inArray, Axis inAxis=Axis::NONE)</div><div class="ttdef"><b>Definition:</b> centerOfMass.hpp:48</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_34171bd951b13a53aa9f237277a18e40.html">NumCpp</a></li><li class="navelem"><a class="el" href="dir_d4391026049f7aede16e9c18d53d30b9.html">ImageProcessing</a></li><li class="navelem"><a class="el" href="_centroid_8hpp.html">Centroid.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
